/*
*
==============================================================================
*  Name        : 
*  Part of     : Omen Game Engine - Example Game
*  Description : 
*  Version     : 1.0
*
*  Copyright (c) 2013 Lauri Kortevaara.
* 
==============================================================================
*/

#include <iostream>
#include <stdexcept>
#include <Windows.h>

#include "GUIConsole.h"

#include "OmenGame.h"

using namespace std;

/// <summary>Program entry point</summary>
int WINAPI WinMain( HINSTANCE    hInstance,            // Instance
                    HINSTANCE    hPrevInstance,        // Previous Instance
                    LPSTR        lpCmdLine,            // Command Line Parameters
                    int          nCmdShow)            // Window Show State
{

   RedirectIOToConsole();
   AllocConsole();

   // Create the game instance, initialize it and start playing.
   OmenGame game;
   try {
       if( game.initialize() )
       {
           game.run();
       }
   }catch( std::runtime_error error )
   {
       MessageBoxA( NULL, error.what(), "Error in Omen Game!", MB_OK );
   }
   catch( std::exception error )
   {
       MessageBoxA( NULL, error.what(), "Error in Omen Game!", MB_OK );
   }
   catch(...)
   {
       MessageBoxA( NULL, "FATAL ERROR", "Error in Omen Game!", MB_OK );
   }
}
